package day2

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment

object _05_BasicTransformation_Demos_scala {
  def main(args: Array[String]): Unit = {

    val env = StreamExecutionEnvironment.getExecutionEnvironment

    import org.apache.flink.api.scala._
    val source = env.fromCollection(List("a,1,28_b,2,33"))

    source.flatMap(s=>s.split("_"))

    val sqlStr=
      """
        |CREATE TABLE KafkaTable (
        |  `user_id` BIGINT,
        |  `item_id` BIGINT,
        |  `behavior` STRING,
        |  `ts` TIMESTAMP(3) METADATA FROM 'timestamp'
        |) WITH (
        |  'connector' = 'kafka',
        |  'topic' = 'user_behavior',
        |  'properties.bootstrap.servers' = 'localhost:9092',
        |  'properties.group.id' = 'testGroup',
        |  'scan.startup.mode' = 'earliest-offset',
        |  'format' = 'csv'
        |)
        |
        |""".stripMargin


  }

}
